﻿namespace Rsdn.SmartApp
{
    using JetBrains.Annotations;
    using System;

    /// <summary>
    /// Default <see cref="T:Rsdn.SmartApp.IKeyedElementInfo`1" /> implementation.
    /// </summary>
    public abstract class KeyedElementInfo<TKey> : ElementInfo, IKeyedElementInfo<TKey>
    {
        private readonly TKey _key;

        /// <summary>
        /// Initialize instance.
        /// </summary>
        protected KeyedElementInfo([NotNull] Type type, TKey key)
            : base(type)
        {
            this._key = key;
        }

        /// <summary>
        /// Initialize instance.
        /// </summary>
        protected KeyedElementInfo([NotNull] Type type, TKey key, string description) :
            base(type, description)
        {
            this._key = key;
        }

        /// <summary>
        /// Key.
        /// </summary>
        public TKey Key
        {
            get
            {
                return this._key;
            }
        }
    }
}

